/**
 * 
 */
package de.cbf.cam.dsa.model.entities.items;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;

/**
 * @author Nebelritter
 *
 */
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
public class Container extends Item {
	/**
	 * @uml.property  name="volume"
	 */
	private String volume="";
	
	/**
	 * @uml.property  name="itemsInside"
	 * @uml.associationEnd  multiplicity="(0 -1)" elementType="de.cbf.cam.dsa.model.entities.items.Item"
	 */
	private List<Item> itemsInside = new ArrayList<Item>();
	
	public Container(String wearPlace) {
		super();
		this.wear = wearPlace;		
	}
	

	/**
	 * @return  the volume
	 * @uml.property  name="volume"
	 */
	public String getVolume() {
		return volume;
	}

	/**
	 * @param volume  the volume to set
	 * @uml.property  name="volume"
	 */
	public void setVolume(String volume) {
		this.volume = volume;
	}

	public List<Item> getItemsInside() {
		return itemsInside;
	}

	public boolean addItem(Item item){
		item.setWear(getName());
		return itemsInside.add(item);
	}
	
	public boolean removeItem(Item item){
		return itemsInside.remove(item);
	}
	
	public void setItemsInside(List<Item> itemsInside) {
		this.itemsInside = itemsInside;
	}
}
